﻿CREATE PROCEDURE [acms].[Post_Delete]
	@Id int,
	@VersionId timestamp
AS
	Update [Posts]
	Set Deleted = 1
	Where Id = @Id
		and VersionId = @VersionID
		and Deleted = 0
		
	if @@RowCount <> 1 begin
		if Exists (Select null From Post_View Where Id = @id)
			return -100
		else
			return -200
	end
RETURN 0;